
import java.io.File;
import java.io.IOException;
import java.util.Vector;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.UnsupportedAudioFileException;

import comirva.audio.extraction.TimbreDistributionExtractor;
import comirva.audio.util.AudioPreProcessor;
import comirva.audio.util.MFCC;

public class Test {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Window finestra=new Window();
		// TODO Auto-generated method stub
		File f=new File("C:\\Users\\Andrea\\Desktop\\cantchange.wav");
		AudioInputStream audioInputStream = null;
		try {
			audioInputStream=AudioSystem.getAudioInputStream(f);
			AudioFormat format = audioInputStream.getFormat();
			//System.out.println(format.getSampleRate());
			AudioPreProcessor pre=new AudioPreProcessor(audioInputStream, format.getSampleRate());
			MFCC m=new MFCC(format.getSampleRate());
			Vector<double[]> v=m.process(pre);
			for(int i=0; i<v.size();i++){
				for(int z=0; z<v.get(i).length;z++){
					System.out.print(v.get(i)[z]+"  ");
				}
				System.out.println("");
			}
			System.out.println(v.size()+"  "+v.get(0).length);
		} catch (UnsupportedAudioFileException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}
}